import { createRouter, createWebHistory } from 'vue-router'
//导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'
import FoodOrderVue from '@/views/food/FoodOrder.vue'
import FoodManageVue from '@/views/food/FoodManage.vue'
import SellerInfoVue from '@/views/seller/SellerInfo.vue'
import BuyerInfoVue from '@/views/buyer/BuyerInfo.vue'
import SellerResetPasswordVue from '@/views/seller/SellerResetPassword.vue'
import BuyerResetPasswordVue from '@/views/buyer/BuyerResetPassword.vue'
import BuyerLoginVue from '@/views/BuyerLogin.vue'
import MarketVue from "@/views/Market.vue";
import SellerAddress from "@/views/seller/SellerAddress.vue";
import BuyerAddressVue from "@/views/buyer/BuyerAddress.vue";
import MarketMainVue from "@/views/buyer/MarketMain.vue";
import BuyerOrders from "@/views/buyer/BuyerOrders.vue";
import FoodInfoVue from "@/views/buyer/FoodInfo.vue";


//定义路由关系
const routes = [
    { path: '/', component: LoginVue },

    {path: '/buyer',component: BuyerLoginVue},

    {path: '/market',component: MarketVue,redirect:'/buyer/market',children: [
            {path: '/buyer/info',component: BuyerInfoVue},
            {path: '/buyer/resetPassword',component: BuyerResetPasswordVue},
            {path: '/buyer/address',component:BuyerAddressVue },
            {path: '/buyer/market',component: MarketMainVue},
            {path: '/buyer/orders',component: BuyerOrders},
            {path:'/buyer/foodInfo',component: FoodInfoVue}
        ]
    },

    {
        path: '/seller', component: LayoutVue, redirect:'/food/manage', children: [
            {path :'/seller/address',component:SellerAddress},
            { path: '/food/order', component: FoodOrderVue},
            { path: '/food/manage', component: FoodManageVue },
            { path: '/seller/info', component: SellerInfoVue },
            { path: '/seller/resetPassword', component: SellerResetPasswordVue }

        ]
    }


]

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

//导出路由
export default router
